import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;
import javax.swing.JTextArea;


public class MemJoinForm extends JFrame {

	private JPanel contentPane;
	private JTextField uid;
	private JTextField pwd;
	private JTextField pwdCheck;
	private String telNo[] = { "010", "011", "017" };
	private JTextField textField;
	private JTextField textField_1;
	private JTextField addr;
	private JTextField loc;
	private JTextField name;

	/**
	 * Launch the application.
	 */
	/*public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MemJoinForm frame = new MemJoinForm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}*/

	/**
	 * Create the frame.
	 */
	public MemJoinForm() {
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		setBounds(100, 100, 420, 588);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		setLocationRelativeTo(null);
		
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				int choice = JOptionPane.showConfirmDialog(null, "회원가입창을 닫으시겠습니까?","JoinOn",JOptionPane.YES_NO_OPTION);
				if(choice == JOptionPane.YES_NO_OPTION)
					dispose();
			}
		});
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		
		JLabel txtJoin = new JLabel("회원가입");
		
		JLabel txtUid = new JLabel("아이디 :");
		
		uid = new JTextField();
		uid.setColumns(10);
		
		JButton btnOverlap = new JButton("중복 확인");
		
		JLabel txtPwd = new JLabel("비밀번호 :");
		
		pwd = new JTextField();
		pwd.setColumns(10);
		
		JLabel txtPwdCheck = new JLabel("비밀번호 확인:");
		
		pwdCheck = new JTextField();
		pwdCheck.setColumns(10);
		
		ButtonGroup group = new ButtonGroup();
		JLabel txtSex = new JLabel("성별 :");
		
		JRadioButton rdSexM = new JRadioButton("남");
		rdSexM.setSelected(true);
		
		JRadioButton rdSexF = new JRadioButton("여");
		group.add(rdSexM);
		group.add(rdSexF);
		JButton btnCheck = new JButton("확인");
		
		JButton btnCancel = new JButton("취소");
		
		btnCancel.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				int choice = JOptionPane.showConfirmDialog(null, "회원가입창을 닫으시겠습니까?","JoinOn",JOptionPane.YES_NO_OPTION);
				if(choice == JOptionPane.YES_NO_OPTION)
					dispose();
			}
		});
		
		JLabel txtTel = new JLabel("연락처 :");
		
		JComboBox comboBox = new JComboBox(telNo);
		
		JLabel txtHi1 = new JLabel("-");
		
		textField = new JTextField();
		textField.setColumns(10);
		
		JLabel txtHi2 = new JLabel("-");
		
		textField_1 = new JTextField();
		textField_1.setColumns(10);
		
		JLabel lblAddr = new JLabel("주소 : ");
		
		addr = new JTextField();
		addr.setColumns(10);
		
		JLabel txtLoc = new JLabel("관심지역 :");
		
		loc = new JTextField();
		loc.setColumns(10);
		
		JLabel txtInfo = new JLabel("자기소개 : ");
		
		JTextArea info = new JTextArea();
		
		JLabel txtName = new JLabel("이름 :");
		
		name = new JTextField();
		name.setColumns(10);
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addGap(176)
					.addComponent(txtJoin)
					.addContainerGap(180, Short.MAX_VALUE))
				.addGroup(gl_panel.createSequentialGroup()
					.addGap(29)
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel.createSequentialGroup()
							.addComponent(txtName)
							.addContainerGap())
						.addGroup(gl_panel.createSequentialGroup()
							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
								.addComponent(txtUid)
								.addComponent(txtPwd)
								.addComponent(txtPwdCheck, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
								.addComponent(txtLoc)
								.addComponent(txtInfo)
								.addComponent(txtSex)
								.addComponent(txtTel)
								.addComponent(lblAddr))
							.addGap(5)
							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
								.addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup()
									.addComponent(btnCheck)
									.addGap(18)
									.addComponent(btnCancel)
									.addGap(178))
								.addGroup(gl_panel.createSequentialGroup()
									.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(txtHi1)
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(textField, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(txtHi2, GroupLayout.PREFERRED_SIZE, 6, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED)
									.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE))
								.addGroup(gl_panel.createSequentialGroup()
									.addComponent(rdSexM)
									.addGap(30)
									.addComponent(rdSexF))
								.addGroup(gl_panel.createSequentialGroup()
									.addComponent(pwdCheck, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.addContainerGap())
								.addGroup(gl_panel.createSequentialGroup()
									.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
										.addComponent(uid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(pwd, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
									.addGap(27)
									.addComponent(btnOverlap)
									.addContainerGap())
								.addGroup(gl_panel.createSequentialGroup()
									.addComponent(name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.addContainerGap())
								.addGroup(gl_panel.createSequentialGroup()
									.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
										.addComponent(addr, Alignment.LEADING)
										.addComponent(loc, Alignment.LEADING)
										.addComponent(info, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
									.addContainerGap())))))
		);
		gl_panel.setVerticalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addComponent(txtJoin)
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(txtUid)
						.addComponent(uid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(btnOverlap))
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(txtPwd)
						.addComponent(pwd, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(txtPwdCheck)
						.addComponent(pwdCheck, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(txtName)
						.addComponent(name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel.createSequentialGroup()
							.addGap(33)
							.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
								.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(txtHi1)
								.addComponent(txtHi2)))
						.addGroup(gl_panel.createSequentialGroup()
							.addPreferredGap(ComponentPlacement.RELATED)
							.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
								.addComponent(rdSexM)
								.addComponent(rdSexF)
								.addComponent(txtSex))
							.addGap(18)
							.addComponent(txtTel)))
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(addr, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblAddr))
					.addGap(24)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(txtLoc)
						.addComponent(loc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(info, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)
						.addComponent(txtInfo))
					.addGap(26)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnCheck)
						.addComponent(btnCancel))
					.addGap(41))
		);
		panel.setLayout(gl_panel);
		setResizable(false);
	}
}
